﻿using System;
using System.Collections.Generic;
using System.Text;
using DevExpress.XtraEditors;
using System.Windows.Forms;

namespace Waker.Common
{
    public class UI
    {
        //稍后将此改成多语言
        public static string OKCancelCaption = "确认";
        public static string ErrorCaption = "错误";
        public static string InfoCaption = "提示";
        public static string WarningCaption = "警告";
        public static string AbortRetryIgnoreCaption = "提醒";
        public static string YesNoCaption = "询问";
        public static string YesNoCancelCaption = "询问";

        public static DialogResult ShowOKCancel(string text)
        {
            return ShowOKCancel(text, OKCancelCaption);
        }
        public static bool ShowOKCancelReturnBool(string text)
        {
            return ShowOKCancel(text, OKCancelCaption) == DialogResult.OK;
        }
        public static DialogResult ShowOKCancel(string text, string caption)
        {
            return XtraMessageBox.Show(text, caption, MessageBoxButtons.OKCancel, MessageBoxIcon.Question,
                MessageBoxDefaultButton.Button1);
        }

        public static DialogResult ShowWarningOKCancel(string text, string caption)
        {
            return XtraMessageBox.Show(text, caption, MessageBoxButtons.OKCancel, MessageBoxIcon.Warning,
                MessageBoxDefaultButton.Button1);
        }

        public static DialogResult ShowError(string text)
        {
            return ShowError(text, ErrorCaption);
        }

        public static DialogResult ShowError(string text, string caption)
        {
            return XtraMessageBox.Show(text, caption, MessageBoxButtons.OK, MessageBoxIcon.Error,
                MessageBoxDefaultButton.Button1);
        }

        public static DialogResult ShowInfo(string text)
        {
            return ShowInfo(text, InfoCaption);
        }

        public static DialogResult ShowInfo(string text, string caption)
        {
            return XtraMessageBox.Show(text, caption, MessageBoxButtons.OK, MessageBoxIcon.Information,
                MessageBoxDefaultButton.Button1);
        }

        public static DialogResult ShowWarning(string text)
        {
            return ShowWarning(text, WarningCaption);
        }

        public static DialogResult ShowWarning(string text, string caption)
        {
            return XtraMessageBox.Show(text, caption, MessageBoxButtons.OK, MessageBoxIcon.Exclamation,
                MessageBoxDefaultButton.Button1);
        }

        public static DialogResult ShowAbortRetryIgnore(string text)
        {
            return ShowAbortRetryIgnore(text, AbortRetryIgnoreCaption);
        }

        public static DialogResult ShowAbortRetryIgnore(string text, string caption)
        {
            return XtraMessageBox.Show(text, caption, MessageBoxButtons.AbortRetryIgnore, MessageBoxIcon.Stop, MessageBoxDefaultButton.Button1);
        }

        public static DialogResult ShowYesNo(string text)
        {
            return ShowYesNo(text, YesNoCaption);
        }

        public static DialogResult ShowYesNo(string text, string caption)
        {
            return XtraMessageBox.Show(text, caption, MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);
        }

        public static DialogResult ShowYesNo(string text, MessageBoxIcon type)
        {
            return XtraMessageBox.Show(text, YesNoCaption, MessageBoxButtons.YesNo, type, MessageBoxDefaultButton.Button2);
        }

        public static DialogResult ShowYesNo(string text, string caption, int defaultbutton)
        {
            if (defaultbutton == 1)
                return XtraMessageBox.Show(text, caption, MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);
            else
                return XtraMessageBox.Show(text, caption, MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);
        }

        public static DialogResult ShowYesNoCancel(string text)
        {
            return ShowYesNoCancel(text, YesNoCancelCaption);
        }

        public static DialogResult ShowYesNoCancel(string text, string caption)
        {
            return XtraMessageBox.Show(text, caption, MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);
        }


    }
}
